

WaitUntil{ HumanObjectiveCompleted };

if(!isRinging)then{
	ctrlEnable [IdcBtMatrixExtract,true];
};	

while {dialog && !endDialog} do 
{
	scopeName "detectLoop";

	waitUntil { isPhoneAnswered or (!dialog) or endDialog };

	
	// no more dialog exit the loop
	if((!dialog) or endDialog) then {
		
		 breakOut "detectLoop";
	};	
	
	_humansInCab = (list ExtractTrg);
	
	format["TANK PHONE ANSWERED ! , %1 ",_humansInCab] call debug;
	
	if(count(_humansInCab) > 0)then{
		
		_selectedHuman=	_humansInCab select 0;

		_selectedHuman setPos (getMarkerPos "respawn_guerrila");
		
		format["TANK HUMAN EXTRACTED ! , %1 ",_selectedHuman] call debug;
	};
	
	isPhoneAnswered=false;
	publicvariable "isPhoneAnswered";	
		
	ctrlEnable [IdcBtMatrixExtract,true];
	CbCabList ctrlEnable true;
	
	ctrlSetText [IdcBtMatrixExtract,"Lancer l'appel d'extraction"];	
	
	_marker=format["cab_%1",ExtractCabNumber];
	"-------------- already ringing" call debug;
	_marker setMarkerColorLocal "ColorBlue";
	"mSelectCab" setMarkerColorLocal "ColorGreen";
	

	

	
	sleep 0.5;
	

};
    

